﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Helper;
using System.ComponentModel;
namespace CoreData
{
    public class User_Module_Role
    {
        [Description("ID")]
            public long ID{get;set;}
        [Description("UserID")]
            public long UserID { get; set; }
        [Description("ModuleID")]
            public long ModuleID { get; set; }
        [Description("QUyền")]
            public string Role{get;set;}
        [Description("Tài khoản")]
            public string UserNameExt { get; set; }
        [Description("Module")]
            public string ModuleExt { get; set; }
        [Description("Ghi chú")]
            public string DescriptionExt { get; set; }
        public User_Module_Role()
        {       
                           // UserID ="";   
                           // ModuleID ="";   
                            Role ="";   
        }
        
       static User_Module_Role DynamicCast<T>(object row_data, object row_header) where T : User_Module_Role
       {
           // row_data : DataRow
           // row_header : DataColumnCollection
           User_Module_Role ret = new User_Module_Role();
           DataRow dt = (DataRow)row_data;

           foreach (DataColumn column in (DataColumnCollection)row_header)
           {
               switch (column.ColumnName)
               {
                      case  "ID":
                        ret.ID = ConvertObject.ToLong(dt[column]);
                       break;
                      case  "UserID":
                        ret.UserID = ConvertObject.ToLong(dt[column]);
                       break;
                      case  "ModuleID":
                       ret.ModuleID = ConvertObject.ToLong(dt[column]);
                       break;
                      case  "Role":
                        ret.Role = ConvertObject.ToString(dt[column]);
                       break;
                      case "UserName":
                       ret.UserNameExt = ConvertObject.ToString(dt[column]);
                       break;
                      case "Module":
                       ret.ModuleExt = ConvertObject.ToString(dt[column]);
                       break;
                   case "Description":
                       ret.DescriptionExt = ConvertObject.ToString(dt[column]);
                       break;
                   default:
                       break;
               }
           }

           return ret;
       }
        
    }
}
